#!user/bin/env python3
# -- coding: utf-8 --
# @Createtime：2023/9/11 11:06
# @Updatetime：11:06
# @Author：Test008
# @File：15-多态
# @Description：

"""
多态，指的是多种状态，即完成某个行为时，使用不同的对象会得到不同的状态
"""


# 例1
# 1》先定义一个抽象类，抽象方法
# class Animal:
#     def speak(self):
#         pass

# 2》定义1个子类对象，有具体的成员方法
# class Dog(Animal):
#     def speak(self):
#         print("汪汪汪")

# 2》定义2个子类对象，有具体的成员方法
# class Cat(Animal):
#     def speak(self):
#         print("喵喵喵")

# 3》定义一个函数方法， 传入子类对象，去执行不同的工作
# def make_noise(animal: Animal):
#     animal.speak()


# dog = Dog()
# cat = Cat()
# make_noise(dog)
# make_noise(cat)


# 例2
# class AC:
#     def cool_wind(self):
#         """制冷"""
#         pass
#
#     def hot_wind(self):
#         """制热"""
#         pass
#
#     def swing_l_r(self):
#         """左右摆风"""
#         pass
#
#     def swing_up_down(self):
#         """上下摆风"""
#         pass
#
#     def timing(self):
#         """定时功能"""
#         pass
#
#     def sleep_mode(self):
#         """睡眠模式"""
#         pass
#
#
# class Midea_AC(AC):
#     def cool_wind(self):
#         """制冷"""
#         print("美的空调核心制冷科技")
#
#     def hot_wind(self):
#         """制热"""
#         print("美的空调电热丝加热")
#
#     def swing_l_r(self):
#         """左右摆风"""
#         print("美的空调无风感左右摆风")
#
#     def swing_up_down(self):
#         """上下摆风"""
#         print("美的3D环游上下摆风")
#
#     def timing(self):
#         """定时功能"""
#         print("美的省心定时功能")
#
#     def sleep_mode(self):
#         """睡眠模式"""
#         print("美的三重护眠睡眠模式")
#
#
# class Gree_AC(AC):
#     def cool_wind(self):
#         """制冷"""
#         print("格力空调变频省电制冷")
#
#     def hot_wind(self):
#         """制热"""
#         print("格力空调电热丝加热")
#
#     def swing_l_r(self):
#         """左右摆风"""
#         print("格力空调羽感疏风左右摆风")
#
#     def swing_up_down(self):
#         """上下摆风"""
#         print("格力3D环游上下摆风")
#
#     def timing(self):
#         """定时功能"""
#         print("格力安心好眠定时功能")
#
#     def sleep_mode(self):
#         """睡眠模式"""
#         print("格力清风好梦睡眠模式")
#
#
# def make_cool_wind(ac: AC):
#     """制冷"""
#     ac.cool_wind()
#
#
# def make_hot_wind(ac: AC):
#     """制热"""
#     ac.hot_wind()
#
#
# def make_swing_l_r(ac: AC):
#     """左右摆风"""
#     ac.swing_l_r()
#
#
# def make_swing_up_down(ac: AC):
#     """上下摆风"""
#     ac.swing_up_down()
#
#
# def make_timing(ac: AC):
#     """定时功能"""
#     ac.timing()
#
#
# def make_sleep_mode(ac: AC):
#     """睡眠模式"""
#     ac.sleep_mode()


# media_ac = Midea_AC()
# gree_ac = Gree_AC()
# """制冷"""
# make_cool_wind(media_ac)
# make_cool_wind(gree_ac)
# """制热"""
# make_hot_wind(media_ac)
# make_hot_wind(gree_ac)
# """左右摆风"""
# make_swing_l_r(media_ac)
# make_swing_l_r(gree_ac)
# """上下摆风"""
# make_swing_up_down(media_ac)
# make_swing_up_down(gree_ac)
# """定时功能"""
# make_timing(media_ac)
# make_timing(gree_ac)
# """睡眠模式"""
# make_sleep_mode(media_ac)
# make_sleep_mode(gree_ac)

class Animal:
    def speak(self):
        pass


class Dog(Animal):
    def speak(self):
        print("汪汪汪")


class Cat(Animal):
    def speak(self):
        print("喵喵喵")


class Niu(Animal):
    def speak(self):
        print("哞哞哞")


def make_noise(animal: Animal):
    animal.speak()


dog = Dog()
cat = Cat()
niu = Niu()


# make_noise(cat)
# make_noise(dog)
# make_noise(niu)


class AC:
    def hot_wind(self):
        pass

    def cold_winds(self):
        pass

    def l_and_r(self):
        pass


class Media(AC):
    def hot_wind(self):
        print('美的制热科技')

    def cold_winds(self):
        print("美的制冷科技")

    def l_and_r(self):
        print("美的左右摆风功能")


class Gree(AC):
    def hot_wind(self):
        print('格力制热科技')

    def cold_winds(self):
        print("格力制冷科技")

    def l_and_r(self):
        print("格力左右摆风功能")


def make_hot_wind(ac: AC()):
    ac.hot_wind()


def make_cold_wind(ac: AC()):
    ac.cold_winds()


def make_l_and_r(ac: AC()):
    ac.l_and_r()


media = Media()
gree = Gree()

make_hot_wind(media)
# make_hot_wind(gree)
make_cold_wind(gree)
make_l_and_r(media)